<template>
	<view class="">
		<view class="he1 w100pc"></view>
		<!-- 头部 -->
		<view class="fsb lrmg-30" style="height: 100rpx;">
			<image src="/static/image/9.png" style="width:86rpx;height:50rpx" class="" @click="pageback()"></image>
			<view class="gray272 weight" @tap="pageto('/pages/wode/zz_jilu')">明細</view>
		</view>
		<view class="he3 w100pc"></view>
		<view class="lrmg-40">
			<view class="gray272 weight f30">轉賬</view>
			<view class="mg-t-60 gray272 f26 weight">收款地址</view>
			<textarea placeholder="收款地址" v-model="address" placeholder-class="gray999 f24" class="textarea1"></textarea>
			<view class="mg-t-30 gray272 f24">數量</view>
			<input type="number" :placeholder="'最低轉賬' + shouxufei.min_accounts + '個'" v-model="money" @input="input" placeholder-class="gray999 f24" class="input1" />
			<view class="f20 mg-t-20" style="color: #ABABAD;">可用： {{type== 0 ? userInfo.usdt + ' USDT' : userInfo.lcc + ' MMST'}}</view>
			<view class="mg-t-30 gray272 f24">備注</view>
			<input type="text" v-model="remarks" placeholder="備注" placeholder-class="gray999 f24" class="input1" />
			<view class="mg-t-40 gray272 f24">手續費</view>
			<input type="text" placeholder="10" :disabled="true" v-model="feiyong" placeholder-class="gray999 f24" class="input1" />
			<view class="mg-t-60 gray272 f24">礦工費</view>
			<view class="fsb bra60 mg-t-20" style="padding:0 20rpx;background: #fff;width: 330rpx;height: 60rpx;" @tap="show1 = true">
				<view class="gray333 f22">{{type== 0 ? 'USDT' : 'MMST'}}</view>
				<u-icon name="arrow-right" size="22" color="#333"></u-icon>
			</view>
			<view class="mg-t-60 fsb">
				<u-button type="primary" :ripple="true" :custom-style="customStyle" @click="pageback()">返回</u-button>
				<u-button type="primary" :ripple="true" :custom-style="customStyles" @click="submit">提交</u-button>
			</view>
		</view>
		<view class="he2 w100pc"></view>
		<u-picker mode="selector" v-model="show1"  :default-selector="[0]" :range="selector1" @confirm="xuanze1"></u-picker>
	</view>
</template>

<script>
	var	that
	import {
		_updataTabBar,
		pageto,
		pageback
	} from "../../common/js/sysfun.js"
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default{
		data(){
			return{
				show1: false,
				selector1: ['USDT','MMST'],
				flag:0,
				show:false,
				customStyle: {
					color: '#fff',
					background:'#30333E',
					width:'280rpx',
					fontWeight:'bold',
					fontSize:'30rpx',
					borderRadius:'60rpx'
				},
				customStyles: {
					color: '#FFF',
					background:'#31B898',
					width:'280rpx',
					fontWeight:'bold',
					fontSize:'30rpx',
					borderRadius:'60rpx'
				},
				address:'',
				money:'',
				remarks:'',
				type:0,
				userInfo:{},
				feiyong:0,
				shouxufei:{}
			}
		},
		onLoad() {
			that = this
			that.shouxu()
			that.getUser()
		},
		methods:{
			submit(){
				uni.showLoading({
					mask: true
				});
				let data = {
					address:that.address,
					remarks:that.remarks,
					money:that.money,
					type:that.type + 1
				}
				that.$postAjax('api/Finance/transfer_accounts',data,function(res){
					uni.hideLoading()
					that.address = ''
					that.remarks = ''
					that.money = ''
					that.feiyong = 0
					uni.showToast({
						title: '成功',
						icon: 'none'
					});
					that.getUser()
				})
			},
			input(){
				let money = Number(that.money)
				let xu = Number(that.shouxufei.accounts_withdrawal)/100
				that.feiyong = (money * xu).toFixed(2)
			},
			shouxu(){
				that.$postAjax('api/Finance/finance_config','',function(res){
					console.log(res);
					that.shouxufei = res.data
				})
			},
			getUser(){
				that.$postAjax('api/Member/wallet','',function(res){
					console.log(res);
					that.userInfo = res.data
				})
			},
			xuanze1(e){
				// console.log(e[0]);
				that.type = e[0]
			},
			dianji(e){
				that.flag = e
				that.show = !that.show
			},
			pageto(url, pp) {
				pageto(url, pp);
			},
			pageback(){
				pageback()
			}
		}
	}
</script>

<style lang="scss">
	.input1{
		background: #fff;
		margin-top: 20rpx;
		border-radius: 60rpx;
		width: 330rpx;
		color: #666;
		font-size: 24rpx;
		padding-left: 20rpx;
		height: 60rpx;
	}
	.textarea1{
		background: #fff;
		margin-top: 20rpx;
		border-radius: 20rpx;
		padding: 20rpx;
		width: calc(100% - 40rpx);
		color: #666;
		font-size: 24rpx;
		height: 100rpx;
	}
	.textarea2{
		background: #fff;
		margin-top: 20rpx;
		border-radius: 20rpx;
		padding: 30rpx;
		width: calc(100% - 40rpx);
		color: #666;
		font-size: 24rpx;
	}
	.one1{
		background: #fff;
		width: 200rpx;
		height: 200rpx;
		border-radius: 20rpx;
	}
	.one2{
		background: #18376F;
			padding: 30rpx 30rpx 0rpx;
			position: absolute;
			left: 0;
			top: 80rpx;
	}
</style>